package com.aisile.sellergoods.service.impl;

import com.aisile.mapper.TbItemCatMapper;
import com.aisile.pojo.TbItemCat;
import com.aisile.pojo.TbItemCatExample;
import com.aisile.sellergoods.service.ItemCatService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class ItemCatServiceImpl implements ItemCatService{
    @Autowired
    TbItemCatMapper tbItemCatMapper;

    @Override
    public List<TbItemCat> findByParentId(long parentId) {

        TbItemCatExample tbItemCatExample=new TbItemCatExample();
        tbItemCatExample.createCriteria().andParentIdEqualTo(parentId);

      return  tbItemCatMapper.selectByExample(tbItemCatExample);


    }

    @Override
    public TbItemCat findOne(long id) {

        return tbItemCatMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TbItemCat> findAll() {

        return tbItemCatMapper.selectByExample(null);
    }
}
